package com.tanhua.dubbo.api.db;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.Question;
import com.tanhua.domain.db.UserFreeze;
import com.tanhua.dubbo.mapper.UserFreezeMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class UserFreezeApiImpl implements UserFreezeApi{
    @Autowired
    private UserFreezeMapper userFreezeMapper;

    @Override//保存到表中
    public void save(UserFreeze userFreeze) {
        userFreezeMapper.insert(userFreeze);
    }

    @Override//根据id查询表
    public UserFreeze findById(Long userId) {
        QueryWrapper<UserFreeze> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(UserFreeze::getUserId,userId);
        return userFreezeMapper.selectOne(queryWrapper);

    }

    @Override//删除tb_user_freeze表中的单条数据
    public void deleteById(Long userId) {
        QueryWrapper<UserFreeze> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(UserFreeze::getUserId,userId);
        userFreezeMapper.delete(queryWrapper);


    }

}
